package Code.Day1_20240918.com.dx.day01;

import java.util.Scanner;

/**
 * @ClassName Test04
 * @Description Scanner类
 * @Author 12994
 * @Date 2024/9/18 17:30
 * @Version 1.0
 **/
public class Test04 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);

        System.out.print("请输入一个整数:");
        int now_int = input.nextInt(); // 获取控制台输入的下一个整型
        System.out.println("你输入的整数是: " + now_int);

        System.out.print("请输入一个小数:");
        double now_double = input.nextDouble();
        System.out.println("你输入的小数是: " + now_double);

        System.out.print("请输入一个bool值(true or false): ");
        boolean now_boolean = input.nextBoolean(); // true or false
        System.out.println("你输入的bool值是: " + now_boolean);

        System.out.print("请输入字符串: ");
        String now_string = input.next(); // 获得字符串
        System.out.println("你输入的字符串是: " + now_string);

        System.out.print("请输入字符: ");
        char now_char = input.next().charAt(0); // 获得第一个字符
        System.out.println("你输入的字符是: " + now_char);
    }
}
